import { AxiosAccount } from '../utils/http/request';
//角色管理
enum Api {
  list = '/store-back/system/role/list',
  add = '/store-back/system/role/add',
  update = '/store-back/system/role/edit',
  delete = '/store-back/system/role/delete',
  all = '/store-back/system/role/all',
  rulelist = '/store-back/system/role/rule-list',
  ruleset = '/store-back/system/role/rule-set',
}
//用户管理
enum userApi {
  list = '/store-back/system/user/list',
  add = '/store-back/system/user/add',
  update = '/store-back/system/user/edit',
  detail = '/store-back/system/user/detail',
  delete = '/store-back/system/user/delete',
  upload = '/store-back/file/upload/image',
}
//权限管理
enum powerApi {
  list = '/store-back/system/rule/list',
  add = '/store-back/system/rule/add',
  update = '/store-back/system/rule/edit',
  delete = '/store-back/system/rule/delete',
}

// 获取角色列表
export const roleList = (data: any) =>
  AxiosAccount.request({
    url: Api.list,
    method: 'post',
    data,
  });
// 获取所有角色
export const roleListAll = () =>
  AxiosAccount.request({
    url: Api.all,
    method: 'post',
  });
// 添加角色
export const roleAdd = (data: any) =>
  AxiosAccount.request({
    url: Api.add,
    method: 'post',
    data,
  });
// 修改角色
export const updateAdd = (data: any) =>
  AxiosAccount.request({
    url: Api.update,
    method: 'post',
    data,
  });
// 删除角色
export const deleteRole = (data: any) =>
  AxiosAccount.request({
    url: Api.delete,
    method: 'post',
    data,
  });

// 获取角色配置权限
export const rulelist = (data: any) =>
  AxiosAccount.request({
    url: Api.rulelist,
    method: 'post',
    data,
  });
// 配置角色权限
export const ruleset = (data: any) =>
  AxiosAccount.request({
    url: Api.ruleset,
    method: 'post',
    data,
  });

// 获取用户列表
export const userList = (data: any) =>
  AxiosAccount.request({
    url: userApi.list,
    method: 'post',
    data,
  });
// 添加用户
export const userAdd = (data: any) =>
  AxiosAccount.request({
    url: userApi.add,
    method: 'post',
    data,
  });
// 修改用户
export const updateUser = (data: any) =>
  AxiosAccount.request({
    url: userApi.update,
    method: 'post',
    data,
  });
// 用户详情
export const detailUser = (data: any) =>
  AxiosAccount.request({
    url: userApi.detail,
    method: 'post',
    data,
  });
// 删除用户
export const deleteUser = (data: any) =>
  AxiosAccount.request({
    url: userApi.delete,
    method: 'post',
    data,
  });

// 获取权限列表
export const powerList = (data: any) =>
  AxiosAccount.request({
    url: powerApi.list,
    method: 'post',
    data,
  });
// 添加权限
export const powerAdd = (data: any) =>
  AxiosAccount.request({
    url: powerApi.add,
    method: 'post',
    data,
  });
// 修改权限
export const updatePower = (data: any) =>
  AxiosAccount.request({
    url: powerApi.update,
    method: 'post',
    data,
  });
// 删除权限
export const deletePower = (data: any) =>
  AxiosAccount.request({
    url: powerApi.delete,
    method: 'post',
    data,
  });

//上传文件
export const uploadFile = (data: any) =>
  AxiosAccount.request({
    url: userApi.upload,
    method: 'post',
    data,
  });
